home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Sync C Library Procedures Sync
-
-
-
- _________________________________________________________________
-
- NNAAMMEE
- Sync - Synchronization overview
-
- SSYYNNOOPPSSIISS
- This section provides an overview of the Sprite SSyynncc__ system
- routines.
-
- _________________________________________________________________
-
- DDEESSCCRRIIPPTTIIOONN
- Sprite provides system calls to allow processes to synchron-
- ize execution using Mesa-style monitors.
-
- The following set of macros are used to emulate monitored
- procedures of Mesa. The LLOOCCKK__MMOONNIITTOORR and UUNNLLOOCCKK__MMOONNIITTOORR
- macros depend on a constant LLOOCCKKPPTTRR. LLOOCCKKPPTTRR should be
- defined as the address of the lock variable used to lock the
- monitor. Something like the following two lines of code
- should appear at the beginning of a file of monitored pro-
- cedures.
-
- #include <sync.h>
-
- Sync_Lock modMonitorLock;
- #define LOCKPTR (&modMonitorLock)
-
- The pseudo-keywords IINNTTEERRNNAALL and EENNTTRRYY denote internal and
- entry procedures of a monitor. IINNTTEERRNNAALL procedures can only
- be called when the monitor lock is held. EENNTTRRYY procedures
- are procedures that acquire the lock. There may also be
- External procedures. They are the default and there is no
- special keyword. An External procedure doesn't explicitly
- acquire the monitor lock, but may call an EENNTTRRYY procedure.
-
-
- Condition variables represent events that are associated
- with locks. The operations on a condition variable are
- SSyynncc__WWaaiitt and SSyynncc__BBrrooaaddccaasstt. SSyynncc__WWaaiitt allows a process to
- wait for a particular monitor condition to occur.
- SSyynncc__BBrrooaaddccaasstt wakes up all processes waiting on a particu-
- lar condition. The lock must be acquired before a call to
- these routines is made. The lock is released while a pro-
- cess waits on a condition, and is then re-acquired when the
- condition is notified via SSyynncc__BBrrooaaddccaasstt.
-
- SSyynncc__BBrrooaaddccaasstt is the only mechanism for awakening waiting
- processes. For example, there is no means to notify only a
- single process awaiting a particular condition. If several
- processes are awaiting the availability of a single shared
- resource, all processes awaiting the condition must be noti-
- fied; they must each recheck for the availability of the
- resource, and all but one will find the resource unavailable
-
-
-
- Sprite v.1.0 Printed: April 10, 1989 1
-
-
-
-
-
-
- Sync C Library Procedures Sync
-
-
-
- and wait again.
-
- SSyynncc__WWaaiittTTiimmee is used to cause the process to sleep for a
- specific amount of time. The process will be woken up if a
- signal arrives.
-
- SSEEEE AALLSSOO
- Sync_Broadcast, Sync_Wait, Sync_WaitTime
-
- KKEEYYWWOORRDDSS
- synchronization, wait, block, process, event, wakeup, broad-
- cast
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sprite v.1.0 Printed: April 10, 1989 2
-
-
-
-